﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using WebService.DataAccess;using WebService.BusinessEntities;

namespace WebService.DataAccess
{
    /// <summary>
    /// Construct a GameHistoryWallet object from a datareader.
    /// </summary>
    internal class GET_USER_GAMES_PROCFactory : IDomainObjectFactory<GameHistoryWallet>
    {
        public GameHistoryWallet Construct(IDataReader reader)
        {
            GameHistoryWallet gameHistoryWallet = new GameHistoryWallet();

            int game_idIndex = reader.GetOrdinal("game_id");
            if (!reader.IsDBNull(game_idIndex))
            {
                gameHistoryWallet.game_id = reader.GetInt32(game_idIndex);

            }

            int typeIndex = reader.GetOrdinal("type");
            if (!reader.IsDBNull(typeIndex))
            {
                gameHistoryWallet.type = reader.GetString(typeIndex);

            }

            int start_dateIndex = reader.GetOrdinal("start_date");
            if (!reader.IsDBNull(start_dateIndex))
            {
                gameHistoryWallet.start_date = reader.GetDateTime(start_dateIndex);

            }

            int completion_dateIndex = reader.GetOrdinal("completion_date");
            if (!reader.IsDBNull(completion_dateIndex))
            {
                gameHistoryWallet.completion_date = reader.GetDateTime(completion_dateIndex);

            }

            int room_nameIndex = reader.GetOrdinal("room_name");
            if (!reader.IsDBNull(room_nameIndex))
            {
                gameHistoryWallet.room_name = reader.GetString(room_nameIndex);

            }

            int debitIndex = reader.GetOrdinal("debit");
            if (!reader.IsDBNull(debitIndex))
            {
                gameHistoryWallet.debit = reader.GetInt32(debitIndex);

            }

            int creditIndex = reader.GetOrdinal("credit");
            if (!reader.IsDBNull(creditIndex))
            {
                gameHistoryWallet.credit = reader.GetInt32(creditIndex);

            }


            return gameHistoryWallet;
        }
    }
}

